#include "xparameters.h"

void test_power_rs485();


#define AXI_RS485_S00_AXI_SLV_REG0_OFFSET 0
#define AXI_RS485_S00_AXI_SLV_REG1_OFFSET 4
#define AXI_RS485_S00_AXI_SLV_REG2_OFFSET 8
#define AXI_RS485_S00_AXI_SLV_REG3_OFFSET 12
#define AXI_RS485_S00_AXI_SLV_REG4_OFFSET 16
#define AXI_RS485_S00_AXI_SLV_REG5_OFFSET 20
#define AXI_RS485_S00_AXI_SLV_REG6_OFFSET 24
#define AXI_RS485_S00_AXI_SLV_REG7_OFFSET 28
#define AXI_RS485_S00_AXI_SLV_REG8_OFFSET 32
#define AXI_RS485_S00_AXI_SLV_REG9_OFFSET 36
#define AXI_RS485_S00_AXI_SLV_REG10_OFFSET 40
#define AXI_RS485_S00_AXI_SLV_REG11_OFFSET 44
#define AXI_RS485_S00_AXI_SLV_REG12_OFFSET 48
#define AXI_RS485_S00_AXI_SLV_REG13_OFFSET 52
#define AXI_RS485_S00_AXI_SLV_REG14_OFFSET 56
#define AXI_RS485_S00_AXI_SLV_REG15_OFFSET 60
#define AXI_RS485_S00_AXI_SLV_REG16_OFFSET 64
#define AXI_RS485_S00_AXI_SLV_REG17_OFFSET 68
#define AXI_RS485_S00_AXI_SLV_REG18_OFFSET 72
#define AXI_RS485_S00_AXI_SLV_REG19_OFFSET 76
#define AXI_RS485_S00_AXI_SLV_REG20_OFFSET 80
#define AXI_RS485_S00_AXI_SLV_REG21_OFFSET 84
#define AXI_RS485_S00_AXI_SLV_REG22_OFFSET 88
#define AXI_RS485_S00_AXI_SLV_REG23_OFFSET 92
#define AXI_RS485_S00_AXI_SLV_REG24_OFFSET 96
#define AXI_RS485_S00_AXI_SLV_REG25_OFFSET 100
#define AXI_RS485_S00_AXI_SLV_REG26_OFFSET 104
#define AXI_RS485_S00_AXI_SLV_REG27_OFFSET 108
#define AXI_RS485_S00_AXI_SLV_REG28_OFFSET 112
#define AXI_RS485_S00_AXI_SLV_REG29_OFFSET 116
#define AXI_RS485_S00_AXI_SLV_REG30_OFFSET 120
#define AXI_RS485_S00_AXI_SLV_REG31_OFFSET 124
#define AXI_RS485_S00_AXI_SLV_REG32_OFFSET 128
#define AXI_RS485_S00_AXI_SLV_REG33_OFFSET 132
#define AXI_RS485_S00_AXI_SLV_REG34_OFFSET 136
#define AXI_RS485_S00_AXI_SLV_REG35_OFFSET 140
#define AXI_RS485_S00_AXI_SLV_REG36_OFFSET 144
#define AXI_RS485_S00_AXI_SLV_REG37_OFFSET 148
#define AXI_RS485_S00_AXI_SLV_REG38_OFFSET 152
#define AXI_RS485_S00_AXI_SLV_REG39_OFFSET 156
#define AXI_RS485_S00_AXI_SLV_REG40_OFFSET 160
#define AXI_RS485_S00_AXI_SLV_REG41_OFFSET 164
#define AXI_RS485_S00_AXI_SLV_REG42_OFFSET 168
#define AXI_RS485_S00_AXI_SLV_REG43_OFFSET 172
#define AXI_RS485_S00_AXI_SLV_REG44_OFFSET 176
#define AXI_RS485_S00_AXI_SLV_REG45_OFFSET 180
#define AXI_RS485_S00_AXI_SLV_REG46_OFFSET 184
#define AXI_RS485_S00_AXI_SLV_REG47_OFFSET 188
#define AXI_RS485_S00_AXI_SLV_REG48_OFFSET 192
#define AXI_RS485_S00_AXI_SLV_REG49_OFFSET 196
#define AXI_RS485_S00_AXI_SLV_REG50_OFFSET 200
#define AXI_RS485_S00_AXI_SLV_REG51_OFFSET 204
#define AXI_RS485_S00_AXI_SLV_REG52_OFFSET 208
#define AXI_RS485_S00_AXI_SLV_REG53_OFFSET 212
#define AXI_RS485_S00_AXI_SLV_REG54_OFFSET 216
#define AXI_RS485_S00_AXI_SLV_REG55_OFFSET 220
#define AXI_RS485_S00_AXI_SLV_REG56_OFFSET 224
#define AXI_RS485_S00_AXI_SLV_REG57_OFFSET 228
#define AXI_RS485_S00_AXI_SLV_REG58_OFFSET 232
#define AXI_RS485_S00_AXI_SLV_REG59_OFFSET 236
#define AXI_RS485_S00_AXI_SLV_REG60_OFFSET 240
#define AXI_RS485_S00_AXI_SLV_REG61_OFFSET 244
#define AXI_RS485_S00_AXI_SLV_REG62_OFFSET 248
#define AXI_RS485_S00_AXI_SLV_REG63_OFFSET 252


//#define rs485_base_addr         	XPAR_AXI_RS485_0_S00_AXI_BASEADDR
#define rs485_send_count_reg     	AXI_RS485_S00_AXI_SLV_REG0_OFFSET
#define rs485_rst_reg           	AXI_RS485_S00_AXI_SLV_REG2_OFFSET

#define rs485_send_reg0         	AXI_RS485_S00_AXI_SLV_REG16_OFFSET
#define rs485_send_reg1         	AXI_RS485_S00_AXI_SLV_REG17_OFFSET
#define rs485_send_reg2 			AXI_RS485_S00_AXI_SLV_REG18_OFFSET
#define rs485_send_reg3		 		AXI_RS485_S00_AXI_SLV_REG19_OFFSET
#define rs485_send_reg4 			AXI_RS485_S00_AXI_SLV_REG20_OFFSET
#define rs485_send_reg5 			AXI_RS485_S00_AXI_SLV_REG21_OFFSET
#define rs485_send_reg6 			AXI_RS485_S00_AXI_SLV_REG22_OFFSET
#define rs485_send_reg7 			AXI_RS485_S00_AXI_SLV_REG23_OFFSET

#define rs485_rxenable_reg      	AXI_RS485_S00_AXI_SLV_REG1_OFFSET
#define rs485_rcv_reg0          	AXI_RS485_S00_AXI_SLV_REG32_OFFSET
#define rs485_rcv_reg1          	AXI_RS485_S00_AXI_SLV_REG33_OFFSET
#define rs485_rcv_reg2          	AXI_RS485_S00_AXI_SLV_REG34_OFFSET
#define rs485_rcv_reg3 		   		AXI_RS485_S00_AXI_SLV_REG35_OFFSET
#define rs485_rcv_reg4		 		AXI_RS485_S00_AXI_SLV_REG36_OFFSET
#define rs485_rcv_reg5 		    	AXI_RS485_S00_AXI_SLV_REG37_OFFSET
#define rs485_rcv_reg6 		    	AXI_RS485_S00_AXI_SLV_REG38_OFFSET
#define rs485_rcv_reg7 		    	AXI_RS485_S00_AXI_SLV_REG39_OFFSET

#define rs485_txend_reg 			AXI_RS485_S00_AXI_SLV_REG6_OFFSET
#define rs485_rxend_reg 			AXI_RS485_S00_AXI_SLV_REG7_OFFSET
#define rs485_txstatus_clear_reg    AXI_RS485_S00_AXI_SLV_REG3_OFFSET
#define rs485_rxstatus_clear_reg    AXI_RS485_S00_AXI_SLV_REG4_OFFSET

#define UART485_PKT_STATUS_OFFSET       7

#define UART485_PKT1_12V_V_LOW_OFFSET   8
#define UART485_PKT1_12V_V_HIGH_OFFSET  9

#define UART485_PKT1_12V_I_LOW_OFFSET   10
#define UART485_PKT1_12V_I_HIGH_OFFSET  11

#define UART485_PKT1_5V_V_LOW_OFFSET    12
#define UART485_PKT1_5V_V_HIGH_OFFSET   13

#define UART485_PKT1_TEMP_PW1_OFFSET    17

#define UART485_PKT2_48V1_V_LOW_OFFSET  8
#define UART485_PKT2_48V1_V_HIGH_OFFSET 9

#define UART485_PKT2_5V_I_LOW_OFFSET    10
#define UART485_PKT2_5V_I_HIGH_OFFSET   11

#define UART485_PKT2_48V2_V_LOW_OFFSET  12
#define UART485_PKT2_48V2_V_HIGH_OFFSET 13

#define UART485_PKT2_TEMP_PW2_OFFSET    17

#define PWR_UDP_COM_STATUS_OFFSET       0
#define PWR_UDP_MODULE_TYPE_OFFSET      1
#define PWR_UDP_STATUS_OFFSET           2
#define PWR_UDP_12V_V_LOW_OFFSET        3
#define PWR_UDP_12V_V_HIGH_OFFSET       4
#define PWR_UDP_12V_I_LOW_OFFSET        5
#define PWR_UDP_12V_I_HIGH_OFFSET       6
#define PWR_UDP_5V_V_LOW_OFFSET         7
#define PWR_UDP_5V_V_HIGH_OFFSET        8
#define PWR_UDP_5V_I_LOW_OFFSET         9
#define PWR_UDP_5V_I_HIGH_OFFSET        10
#define PWR_UDP_48V1_V_LOW_OFFSET       11
#define PWR_UDP_48V1_V_HIGH_OFFSET      12
#define PWR_UDP_48V2_V_LOW_OFFSET       13
#define PWR_UDP_48V2_V_HIGH_OFFSET      14
#define PWR_UDP_TEMP_SAN1_OFFSET        15
#define PWR_UDP_TEMP_AMB_OFFSET         16

#define UART485_RECV_BUFFER_SIZE  6
